liwe.browser_id = -1;

( function () 
{
	var w = window;

	var nav = w.navigator,
		scr = w.screen,
		_params = {
			screenSize: scr.width + 'x' + scr.height + 'x' + scr.colorDepth,
			devicePixelRatio: w.devicePixelRatio || 1,
			timezone: new Date().getTimezoneOffset(),
			mimeTypes: [],
			plugins: []
		},
		_nav = [
			'appCodeName',
			'appName',
			'appVersion',
			'cookieEnabled',
			'language',
			'platform',
			'product',
			'productSub',
			'userAgent',
			'vendor',
			'vendorSub'
		],
		fingerprint = '';

	function init () {
		var i, l;

		// Get the Navigator params
		for ( i = 0, l = _nav.length; i < l; i++ ) 
			_params [ _nav [ i ] ] = _nav [ i ] in nav ? nav [ _nav [ i ] ] : '';

		// Get the mime types
		if ( 'mimeTypes' in nav ) {
			for ( i = 0, l = nav.mimeTypes.length; i < l; i++ ) 
				_params.mimeTypes.push ( nav.mimeTypes [ i ].description + ',' + nav.mimeTypes [ i ].suffixes + ',' + nav.mimeTypes [ i ].type );

			_params.mimeTypes = _params.mimeTypes.join(',');
		}

		// Get the plugins
		if ( 'plugins' in nav ) 
			for ( i = 0, l = nav.plugins.length; i < l; i++ ) _params.plugins.push( nav.plugins[i].description + ',' + nav.plugins[i].filename + ',' + nav.plugins[i].name );

		liwe.browser_id = MD5.hex_md5 ( makeFingerprint () );
	}

	function makeFingerprint () {
		var i, out = [];

		for ( i in _params ) out.push ( _params [ i ] );

		return out.join(';');
	}

	init();
} ) ();
